package com.other;

import java.io.UnsupportedEncodingException;

/**
 * Created by baiguantao on 2017/6/20.
 * 解密加密工具类
 * 中文时使用
 */
public class DeEncode {
    /**
     * 解密
     * */
    public  static  String decode(String str){
        String result="";
        try {
            result=java.net.URLDecoder.decode(str,"utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return  result;
    }
    /**
     * 加密
     * */
    public  static  String encode(String str){
        String result="";
        try {
            result=java.net.URLEncoder.encode(str,"utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return  result;
    }
}
